using System; 
using System.Collections.Generic; 
using System.Text; 
using FluentNHibernate.Mapping;
using Managistics.Model; 

namespace Managistics.Model.Mappings {
    
    
    public class CustomersMap : ClassMap<Customers> {
        
        public CustomersMap() {
			Table("CUSTOMERS");
			LazyLoad();
			Id(x => x.Customerid).GeneratedBy.Assigned().Column("CUSTOMERID");
			References(x => x.City).Column("CITYID");
			Map(x => x.Customername).Column("CUSTOMERNAME").Not.Nullable().Length(500);
			Map(x => x.ContactPerson).Column("CONTACT_PERSON").Length(50);
			Map(x => x.Addresscompany).Column("ADDRESSCOMPANY").Length(150);
			Map(x => x.Emailcompany).Column("EMAILCOMPANY").Length(30);
			Map(x => x.Websitecompany).Column("WEBSITECOMPANY").Length(50);
			Map(x => x.Telephone).Column("TELEPHONE").Not.Nullable().Length(20);
			Map(x => x.Cellphone).Column("CELLPHONE").Length(20);
			Map(x => x.BankAccountC1).Column("BANK_ACCOUNT_C1").Length(100);
			Map(x => x.BankAccountC2).Column("BANK_ACCOUNT_C2").Length(100);
			Map(x => x.BankAccountC3).Column("BANK_ACCOUNT_C3").Length(100);
			Map(x => x.Taxcode).Column("TAXCODE").Length(20);
			Map(x => x.Fax).Column("FAX").Length(30);
			Map(x => x.Postcar).Column("POSTCAR").Length(15);
			Map(x => x.Status).Column("STATUS").Not.Nullable();
			Map(x => x.Attachfile).Column("ATTACHFILE").Length(1024);
			Map(x => x.Picturecustomer).Column("PICTURECUSTOMER").Length(2147483647);
			Map(x => x.ExtendNumber).Column("EXTEND_NUMBER").Precision(10);
			Map(x => x.AddressDeliver1).Column("ADDRESS_DELIVER_1").Not.Nullable().Length(250);
			Map(x => x.AddressDeliver2).Column("ADDRESS_DELIVER_2").Length(250);
			Map(x => x.AddressDeliver3).Column("ADDRESS_DELIVER_3").Length(250);
			HasMany(x => x.Contactpersons).KeyColumn("CustomerID");
			HasMany(x => x.OrderCustomers).KeyColumn("CUSTOMERID");
        }
    }
}
